﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using You.Niao.ShaFa.IDAL;
using You.Niao.ShaFa.Model;
using DBUtility;
using Common.Base;

namespace You.Niao.ShaFa.DAL
{
	/// <summary>
	/// 数据访问类:ShaFaInfo
	/// </summary>
    public partial class ShaFaInfoDAL : SqlConn, IShaFaInfo
	{
        public int Add(ShaFaInfo shafainfo)
		{
            SqlParameter[] parameters = { new SqlParameter("@ShaFaInfoID",shafainfo.ShaFaInfoID), 
                                        new SqlParameter("@UserID",shafainfo.UserID),
                                        new SqlParameter("@CreateUser",shafainfo.CreateUser),
                                        new SqlParameter("@Type",shafainfo.Type),
                                        new SqlParameter("@Nation",shafainfo.Nation),
                                        new SqlParameter("@Province",shafainfo.Province),
                                        new SqlParameter("@City",shafainfo.City),
                                        new SqlParameter("@Area",shafainfo.Area),
                                        new SqlParameter("@Number",shafainfo.Number),
                                        new SqlParameter("@TourDay",shafainfo.TourDay),
                                        new SqlParameter("@ReceiveWay",shafainfo.ReceiveWay),
                                        new SqlParameter("@Title",shafainfo.Title),
                                        new SqlParameter("@TextID",shafainfo.TextID),
                                        new SqlParameter("@CreateDate",shafainfo.CreateDate),
                                        new SqlParameter("@UserType",shafainfo.UserType)
                                      };
            parameters[0].Direction = ParameterDirection.Output;
            int n = 0;
            int result = DbHelperSQL.RunProcedure(ShaFaConn, "SqlConn", parameters, out n);
            if (parameters[0].Value != DBNull.Value)
            {
                return Convert.ToInt32(parameters[0].Value);
            }
            else return 0;
        }
	}
}

